~ chicken-core (chicken-5) /manual/Module (chicken eval)


 1[[tags: manual]]
 2[[toc:]]
 3
 4== Module (chicken eval)
 5
 6This module provides a handful of hooks that allow more fine-grained
 7control over how the standard procedure {{eval}} behaves.
 8
 9=== Custom eval handlers
10
11==== eval-handler
12
13<parameter>(eval-handler)</parameter>
14
15A procedure of one or two arguments. When {{eval}} is invoked, it
16calls the value of this parameter with the same arguments. The default
17behavior is to evaluate the argument expression and to ignore the
18second parameter.
19
20
21=== Using modules as evaluation environments
22
23==== module-environment
24
25<procedure>(module-environment MODULENAME)</procedure>
26
27Locates the module with the name {{MODULENAME}} and returns an
28environment that can be passed as the second argument to {{eval}}. The
29evaluated expressions have only access to the bindings that are
30visible inside the module. Note that the environment is not mutable.
31
32If the module is not registered in the current process,
33{{module-environment}} will try to locate meta-information about the
34module by loading any existing import library with the name
35{{MODULENAME.import.[scm|so]}}, if possible.
36
37In compiled modules, only exported bindings will be visible to
38interactively entered code. In interpreted modules all bindings are
39visible.
40
41---
42Previous: [[Module (chicken errno)]]
43
44Next: [[Module (chicken file)]]
Trap